﻿<template>
   <el-dialog  :close-on-press-escape="false"  :append-to-body="true" :visible="modalEdit"  @opened="opened" @closed="closed" @close="modalEdit=false">
        <el-form ref="saleOrderItemDetail" label-position="right" label-width="120px" :model="saleOrderItemDetail" :rules="rules">
            <input type="hidden" :model="saleOrderItemDetail.id" />
                                                            <el-form-item label="" prop="itemId">
                                <el-input v-model="saleOrderItemDetail.itemId" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="类型1，送货单，2生产条码" prop="type">
                                <el-input v-model="saleOrderItemDetail.type" placeholder="类型1，送货单，2生产条码" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="客户订单号" prop="poErpNo">
                                <el-input v-model="saleOrderItemDetail.poErpNo" placeholder="客户订单号" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="客户订单行号" prop="poLineNo">
                                <el-input v-model="saleOrderItemDetail.poLineNo" placeholder="客户订单行号" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="客户物料编码" prop="productCode">
                                <el-input v-model="saleOrderItemDetail.productCode" placeholder="客户物料编码" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="客户物料名称" prop="productName">
                                <el-input v-model="saleOrderItemDetail.productName" placeholder="客户物料名称" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="客户规格描述" prop="productScale">
                                <el-input v-model="saleOrderItemDetail.productScale" placeholder="客户规格描述" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="smallPackageCount">
                                <el-input v-model="saleOrderItemDetail.smallPackageCount" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="大箱条码数量" prop="bigPackageCount">
                                <el-input v-model="saleOrderItemDetail.bigPackageCount" placeholder="大箱条码数量" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="外箱条码数量" prop="outPackageCount">
                                <el-input v-model="saleOrderItemDetail.outPackageCount" placeholder="外箱条码数量" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="smallBarcode">
                                <el-input v-model="saleOrderItemDetail.smallBarcode" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="bigBarcode">
                                <el-input v-model="saleOrderItemDetail.bigBarcode" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="outerBarcode">
                                <el-input v-model="saleOrderItemDetail.outerBarcode" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="includeQty">
                                <el-input v-model="saleOrderItemDetail.includeQty" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="bigIncludeQty">
                                <el-input v-model="saleOrderItemDetail.bigIncludeQty" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="" prop="outIncludeQty">
                                <el-input v-model="saleOrderItemDetail.outIncludeQty" placeholder="" style="width: 240px" />
                            </el-form-item>
                                                <el-form-item label="包装层级" prop="packLevel">
                                <el-input v-model="saleOrderItemDetail.packLevel" placeholder="包装层级" style="width: 240px" />
                            </el-form-item>
                                </el-form>
        <div slot="footer">
            <el-button @click="cancel">取消</el-button>
            <el-button type="primary" :loading="modalLoading" @click="ok">确定</el-button>
        </div>
    </el-dialog>
    
</template>
<script>
export default {
    name: 'SaleOrderItemDetail',
    data() {
        return {

            modalEdit: false,
            modalLoading: false,
            saleOrderItemDetailId: "",
            saleOrderItemDetail: {

            },
            rules: {
       
            }
        };
    },
    mounted: function() {


    },
    methods: {
        cbtime: function(value) {
            this.others;
        },
        opened() {
            
                this.getDetail();
          
        },
		closed(){
		   this.saleOrderItemDetail={

                }  
				},
        showDialog(id) {
            this.saleOrderItemDetailId = id;
            this.modalEdit = true;
        },
        getDetail: function() {
            if (this.saleOrderItemDetailId == null || this.saleOrderItemDetailId == undefined || this.saleOrderItemDetailId == "") return;
            var me = this;
            me.showLoading();
            me.$http.get("/saleorderitemdetail/show_" + me.saleOrderItemDetailId + ".do").then(response => {
                var body = response;
                if (body.status == 0) {
                    me.saleOrderItemDetail = body.obj;

                }
                me.hideLoading();
            }, response => {
                me.hideLoading();
            });
        },
        ok: function() {
            var ok = false;
            this.$refs['saleOrderItemDetail'].validate((valid) => {
                ok = valid;
                if (valid) {

                } else {
                    this.errorMessage('请认真填写数据');
                }
            })
            if (!ok) return;
            var me = this;

            me.modalLoading = true;
            me.$http.post("/sys/saleorderitemdetail/doSave.action", me.saleOrderItemDetail).then(response => {
                var body = response;
                if (body.status == 0) {
                    me.successMessage("保存成功！");
                    me.modalEdit = false;
                    me.$emit("ok");

                } else {
                    me.errorMessage("操作异常!" + body.info);
                }
                me.modalLoading = false;
            }, response => {
                me.modalLoading = false;
            });
        },
        cancel: function() {
            this.saleOrderItemDetail = {};
            this.modalEdit = false;
            this.$emit("cancel");
        }
    }
}
</script>
<style scoped>
</style>